package com.qwer.controller.comm;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.qwer.model.comm.UserInfo;

@Controller

public class MainController extends BaseController{

    @RequestMapping(value = { "/", "/goLogin" })
    public String login(Map<String, Object> model,HttpSession session) {
    	session.removeAttribute("sysUser");
        return "login";
    }
    
    @RequestMapping(value = { "/goRegister" })
    public String register(Map<String, Object> model) {
        return "register";
    }
    
    @RequestMapping(value = { "/index" })
    public String index(HttpServletRequest req,Model model) {
        UserInfo user = getLoginUser(req);
        if(user==null){
            return "login";
        }else{
            model.addAttribute("user", user);
            return "index"; 
        }
        
    }
    
    
  
    
    
}
